package com.example.consult.controller;

import com.example.consult.mapper.RecordMapper;
import com.example.consult.model.ConsultLog;
import com.example.consult.model.Suggestion;
import com.example.consult.model.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("/Record")
public class RecordController {
    @Autowired
    HttpServletRequest request;
    HttpSession session ;
    @Autowired
    RecordMapper recordMapper;

    @RequestMapping(value = "search",method = RequestMethod.POST)
    @ResponseBody
    public List<ConsultLog> getAllLog(){
        session=request.getSession();
        UserInfo userInfo = (UserInfo) session.getAttribute("User");
        String userAccount = userInfo.getUser_account();
        return recordMapper.searchByUserAccount(userAccount);
    }




}
